package com.text1;

import java.sql.ResultSet;
import java.sql.SQLException;

public class NewsDaoImp1 extends BaseDao implements NewsDao {


    @Override
    public void getNewsByTitle() {
        try{
            String sql = "SELECT id,categoryid,title,summary,content,author,createdate FROM news_detail";
            Object[] params ={};
            ResultSet re = this.executeSQL(sql ,params);
            while (rs.next()){
                int id=rs.getInt("id");
                int categoryId=re.getInt("categoryid");
                String newsTitle = rs.getString("title");
                String summary = rs.getString("summary");
                String content = rs.getString("content");
                String author = rs.getString("author");
                String createdate = rs.getString("createdate");
                System.out.println(id +"\t"+categoryId +"\t"+newsTitle +"\t"+summary +"\t"+content +"\t"+author +"\t"+createdate);
            }
        } catch (SQLException e) {
            e.printStackTrace();
        }


    }
}
